package com.atguigu.seckill.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author : wenchao.long
 * @date : Created in 2021/8/19 21:38 周四
 * @description :
 */
@Configuration
public class GulimallRedissonConfig {

    /**
     * 所有对Redis的使用都是通过RedissonClient对象
     *
     * @return RedissonClient
     */
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() {
        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://192.168.1.10:6378");

        return Redisson.create(config);
    }
}
